
#include "SpeedPowerUp.h"
#include "../Ship.h"

#include <GL/gl.h>
#include <iostream>

SpeedPowerUp::SpeedPowerUp(Ship *ship) :
    PowerUp(ship),
    speed_increase(2.0f){

    effect_duration = 10;
    effect_start = Timer::currentTicks();

    applied_ship->max_speed    *= speed_increase;
    applied_ship->acceleration *= speed_increase;
}

SpeedPowerUp::~SpeedPowerUp(){
    applied_ship->max_speed    /= speed_increase;
    applied_ship->acceleration /= speed_increase;
}

void SpeedPowerUp::renderIcon(float size){
    glPushMatrix();

    glColor3f(1.0f, 0.0f, 0.0f);
    glBegin(GL_QUADS);
      glVertex3f(-size/2.0f, -size/2.0f, 0.0f);
      glVertex3f(-size/2.0f,  size/2.0f, 0.0f);
      glVertex3f( size/2.0f,  size/2.0f, 0.0f);
      glVertex3f( size/2.0f, -size/2.0f, 0.0f);
    glEnd();

    glPopMatrix();
}

